layui.define([ "table", "form" ], function(exports) {
	var $ = layui.$, tab = layui.table;
	tab.render({
		elem : "#LAY-web-list",
		url : "/customer/order/listJson",
		cols : [ [
			{
				field : "orderNo",
				title : "单号",
				align : "center",
				width : 100
			},
			{
				field : "amountFormat",
				title : "金额(元)",
				align : "center",
                width : 150
			},
			{
				field : "createTime",
				title : "制单时间",
				align : "center",
				width : 180
			},
			{
				field : "bizTypeShow",
				title : "制单类型",
				align : "center",
				width : 160
			},
			{
				field : "orderStatusCustomerShow",
				title : "状态",
				align : "center",
				width : 100
			},
			{
				title : "操作",
				align : "center",
				fixed : "right",
				unresize: true,
				templet: function(d){
					console.log(d);
					if(d.orderStatus=='TS'){
						return '<div><a href="/customer/order/detail?id=' + d.id + '" class="layui-table-link" target="_blank">详情</a> | <a href="javascript:void(0)" class="layui-table-link certificate" target="_blank" orderId="' + d.id + '">回执</a></div>';
					}else{
						return '<div><a href="/customer/order/detail?id=' + d.id + '" class="layui-table-link" target="_blank">详情</a></div>';
					}
				}
			}
		] ],
		page : !0,
		limit : 10,
		limits : [ 10, 15, 20, 25, 30 ],
		text : {none: "暂无相关数据"},
		skin: 'line',
		done: function(){
			// 超链接：显示凭证
			$("table.layui-table td a.certificate").on("click", function(e){
				layer.open({
					title: "查看凭证",
					area: ['80%', '90%'],
					content: "<p style='text-align:center'><img src='/customer/order/certificate?id=" + $(e.target).attr("orderId") + "'></p>",
					btn: ['下载'],
					yes: function(){window.open('/customer/order/certificate?id=' + $(e.target).attr("orderId"), "_blank");}
				});
			});
		}
	}),

	exports("order", {})
});
